(deftemplate number (slot parteIntreaga) (slot parteZecimala))
(deftemplate suma(slot parteIntreaga)(slot parteZecimala))
(assert (number (parteIntreaga 10) (parteZecimala 100)))
(assert (number (parteIntreaga 4) (parteZecimala 900)))
(assert (number (parteIntreaga 2) (parteZecimala 165)))
(assert (number (parteIntreaga 17) (parteZecimala 045)))
(assert (number (parteIntreaga 1) (parteZecimala 131)))
(assert (suma(parteIntreaga 0)(parteZecimala 0)))
(defrule print 
	(number(parteIntreaga ?i)(parteZecimala ?f))
    => (printout t "numarul are partea intreaga " ?i " si partea fractionara " ?f crlf)
)
(defrule aduna
	?idn <- (number(parteIntreaga ?i)(parteZecimala ?f))
    ?idfapt <- (suma(parteIntreaga ?si)(parteZecimala ?sf))
    => 
    	(bind ?s1 (+ ?si ?i (/ ?f 1000)))
    	(modify ?idfapt (parteIntreaga ?s1))
    	(retract ?idn)
)
(defrule afis
    (suma(parteIntreaga ?si))
	=>(printout t ?si )
)
(run)

